package com.normal.practise.exceptionHandler;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author SiYao.Lee
 * @Since 2020-09-15
 * 创建自定义异常类
 * 使用方法
 * throw new GvSysException(20001,"出现自定义异常");
 */

@Data  //生成Getter、Setter等方法
@AllArgsConstructor  // 有参构造方法
@NoArgsConstructor   //无参构造方法
public class GvSysException extends RuntimeException {
    @ApiModelProperty(value = "状态码")
    private Integer code;

    @ApiModelProperty(value = "异常提示信息")
    private String msg;

    @Override
    public String toString() {
        return "GvSysException{" +
                "message=" + this.getMessage() +
                ", code=" + code +
                '}';
    }
}
